<template>
  <el-text>{{ labelText }}</el-text>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useDictStore } from '@/stores'

const props = defineProps({
  dictCode: {
    type: String,
    default: '',
  },
  dictValue: {
    type: Number,
    default: 0,
  },
})

const labelText = computed(() => {
  let res = ''
  switch (props.dictCode) {
    case 'ROLES':
      if (props.dictValue) {
        res = useDictStore().roles.find((e: any) => e.role_id == props.dictValue)?.role_name || ''
      }
      break
  }
  return res
})
</script>
